home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Epic Collection 3
/
Epic Collection 3, The (1997)(Epic Marketing)[!].iso
/
internet
/
ums
/
ums11.6
/
rexx
/
groupcontents.rexx
next >
Wrap
OS/2 REXX Batch file
|
1996-09-08
|
4KB
|
123 lines
/* ------------------------------------------------------------------------
:Program. GroupContents
:Contents. shows contents of one group in UMS' messagebase
:Author. Kai Bolay [kai]
:Address. Snail Mail: EMail:
:Address. Hoffmannstraße 168 UUCP: kai@amokle.stgt.sub.org
:Address. D-71229 Leonberg FIDO: 2:2407/106.3
:History. v1.0 [kai] 23-Sep-93
:History. v1.1 [mh] 26-Sep-93 adaped to skeleton
:History. v1.2 [kai] 29-Sep-93 no skeleton, added MakeFlags()
:History. v1.3 [hG] 16-Jan-94 improofed argument parsing,
:History. added option NoUpdate
:History. v1.4 [hG] 23-Jan-94 uses UMSInit.rexx 1.1 and
:History. hgRexxSupport.library
:History. v2.0 [kai] 21-Dec-94 adapted to UMS v11
:Version. $VER: GroupContents.rexx 2.0 (21.12.94)
:Copyright. Public Domain
:Language. ARexx
:Translator. RexxMast
------------------------------------------------------------------------ */
/*** Startup ***/
options results
RC = 0
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on ERROR
signal on HALT
signal on IOERR
signal on SYNTAX
/*** Init ***/
call addlib("rexxdossupport.library", 0, -30)
call addlib("ums.library", 0, -210, 11)
call UMSInitConsts()
/*** Arguments ***/
ProgramName = "GroupContents";
ArgsTemplate = "NAME/A,PASSWORD,SERVER/K,GROUP/A"
args.SERVER = ""
args.PASSWORD = ""
parse arg arguments
if strip(arguments) = '?' then do
call writech(STDOUT, ArgsTemplate || ': ')
arguments = readln(STDIN)
end; else nop
if ~ReadArgs(arguments,ArgsTemplate,"args.") then do
say Fault(RC, ProgramName)
exit 10
end; else nop
/*** Login ***/
account = UMSLogin(args.name, args.password, args.server)
if account = 0 then do
say "unable to login."
exit 10
end
/*** Do the magic ***/
/* clear local flags 0, 1 and 2 on all messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(), UMSMakeFlags(0, 1, 2),,, "LOCAL", UMSMakeFlags(), UMSMakeFlags())
/* set local flag 1 on all messages of this group */
res = UMSSelectField(account, "LOCAL", UMSMakeFlags(1), UMSMakeFlags(),,, UMSCODE_Group, args.group, TRUE)
/* set local flag 2 on all accessable messages */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(2), UMSMakeFlags(),,, "USER", UMSMakeFlags(UMSUSTAT_ReadAccess), UMSMakeFlags(UMSUSTAT_ReadAccess))
/* set local flag 0 on all messages with flag 1 AND flag 2 set */
res = UMSSelectFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(),,, "LOCAL", UMSMakeFlags(1, 2), UMSMakeFlags(1, 2))
last = 0
do forever
/* find next message with flag 0 set */
last = UMSSearchFlags(account, "LOCAL", UMSMakeFlags(0), UMSMakeFlags(0), last)
if last = 0 then leave
drop msg. /* _IMPORTANT_ */
if ~UMSReadMsgField(account, last, msg., UMSCODE_FromName, TRUE) | ~UMSReadMsgField(account, last, msg., UMSCODE_Subject, TRUE) then do
call CheckErr
end
say right(last, 5, " ") left(msg.UMSCODE_FromName, 20) left(msg.UMSCODE_Subject, 40)
end
/*** Final cleanup ***/
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
SAY "Error: " rc errortext(rc) "Line" sigl
END
/*** Logout ***/
if account ~= 0 then do
call UMSLogout(account)
account = 0
end
exit 0
/*** Support ***/
CheckErr: procedure expose account
err = UMSErrNum(account)
if err ~= 0 then do
say "UMS Error #" || err || ": " || UMSErrTxt(account)
end
return